package perform.database;

import perform.annotations.ComplexIndex;

public class ComplexIndexProcessor {
	
	private ComplexIndex complexIndex;
	private String indexDefinition;

	public ComplexIndexProcessor(ComplexIndex complexIndex) {
		this.complexIndex = complexIndex;
		StringBuilder builder = new StringBuilder("\t");
		builder.append(complexIndex.index().toString().toLowerCase()).append(" ( `");
		String[] columns = complexIndex.columns();
		for (int i = 0; i < columns.length; i++) {
			builder.append(columns[i]).append("` , `");
		}
		indexDefinition = builder.replace(builder.lastIndexOf(","), builder.length(), ") ,\n").toString();
	}

	public ComplexIndex getComplexIndex() {
		return complexIndex;
	}
	public String getIndexDefinition() {
		return indexDefinition;
	}

}
